﻿using System.Windows.Forms;
using pub.CmdUI.Cmd;
using pub.CmdUI.UI.Control;

namespace todo.Cmd.View
{
    public class ShowDueCmd : DefaultCmd, ICmdState
    {

        public ShowDueCmd()
        {
            Shortcut = new CmdShortcut(Keys.Control | Keys.U);
        }

        bool? ICmdState.Checked
        {
            get { return App.Settings.DueVisible; }
        }

        public override void Execute(IControlUI controlUi)
        {
            var dueVisible = !App.Settings.DueVisible;
            App.MainForm.Www.Document.InvokeScript("setColumnVisible",
                    new object[] {"due", dueVisible});
            App.Settings.DueVisible = dueVisible;
        }
    }
}